<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" />
    <!-- 全屏 -->
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <!-- 上方栏显示 -->
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <!-- 不自动识别号码 -->
    <meta name="format-detection" content="telephone=no">
    <!-- Include js plugin -->
    <title>分销推广</title>
    <link rel="stylesheet" href="/static/wap/skin/css/layout.css">
    <link rel="stylesheet" href="/static/wap/skin/css/demos.css">
    <link rel="stylesheet" href="/static/wap/weui/css/weui.min.css">
    <link rel="stylesheet" href="/static/wap/weui/css/jquery-weui.min.css">
    <link href="/static/public/layer/src/css/layui.css" rel="stylesheet">
</head>
<body>

<header class="brB">
  <div class="h_top">
      <div class="hLeft"><a href="/my/home" class="icoH icoReturn mt20"></a></div>
      <div class="hCenter"><span class="tit c-3ac9af">分销</span></div>
    </div>
</header>
<div class="warp">
    <div class="weui-cells">
      <div class="layui-tab-content">
        <style>
        .layui-tab-content{ padding:10px 0px;}
        </style>
        <div id="layui_flow">
            <table class="layui-table" lay-skin="line">
                <thead>
                    <tr>
                        <th>订单号</th>
                        <th>金额</th>
                        <th>类型</th>
                    </tr>
                </thead>
                <tbody>
                <{foreach from=$order item=item}>
                    <tr>
                        <td colspan="3" style="border-bottom: none;">
                            <p><{$item['order_num']}></p>
                            <p></p>
                        </td>
                    </tr>
                    <tr>
                    <td><{$item[ 'add_time']|date_format: '%Y-%m-%d'}></td>
                     <td>
                        <span class="c-ff6600">
                            <{$item['commission']}>
                            (
                            <{if $item['status'] == 0}>
                            未到账
                            <{elseif $item['status'] == 1}>
                            已到账
                            <{/if}>)
                        </span>
                        </td>
                        <td>
                         
                            <{if $item['level'] == 1}>
                            一级分销
                            <{elseif $item['level'] == 2}>
                            二级分销
                            <{elseif $item['level'] == 3}>
                            三级分销
                            <{/if}>
                        </td>
                    </tr>
                <{/foreach}>
                   
                </tbody>
            </table>
        </div>
        <div class="layui-tab-item">交易记录</div>
    </div>

    </div>
</div>

<link href="/static/public/layer/src/css/layui.css" rel="stylesheet">
<script src="/static/public/jquery-1.11.1.min.js" type="text/javascript"></script>
<script src="/static/public/layer/src/layui.js"></script>
<script>
layui.use('flow', function(){
    var flow = layui.flow;
    flow.load({
        elem: '#layui_flow' //流加载容器
        ,isAuto:false
        ,scrollElem: '#layui_flow' //滚动条所在元素，一般不用填，此处只是演示需要。
        ,done: function(page, next){ //执行下一页的回调
            //模拟数据插入
            setTimeout(function(){
                var lis = [];
                if(page > 1){
                    $.ajax({
                        type: "GET",
                        url: "/my/fenxiao/order/"+page,
                        dataType:"json",
                        success: function(result){
                            if(result){
                                $.each(result,function(i,j){
                                    html = '';
                                    html += '<tr>';
                                    html += '<td colspan="3" style="border-bottom: none;">';
                                    html += '<p>'+j.order_num+'</p>';
                                    html += '<p></p>';
                                    html += '</td>';
                                    html += '</tr>';
                                    html += '<tr>';
                                    html += '<td>'+j.add_time+'</td>';
                                    html += '<td>';
                                    html += '<span class="c-ff6600">'+j.commission;
                                    if(j.status == 0){
                                        html += '(未到账)';
                                    }else{
                                        html += '(已到账)';
                                    }
                                    html += '</span>';
                                    html += '</td>';
                                    html += '<td>';
                                    if(j.level == 1){
                                        html += '一级分销';
                                    }else if(j.level == 2){
                                        html += '二级分销';
                                    }else{
                                        html += '三级分销';
                                    }
                                    html += '</td>';
                                    html += '</tr>';

                                    lis.push(html)
                                    $("#layui_flow").find("tr:last").after(html)
                                    // console.log(html)
                                });

                            }
                        }
                    });
                }
                
            //执行下一页渲染，第二参数为：满足“加载更多”的条件，即后面仍有分页
            //pages为Ajax返回的总页数，只有当前页小于总页数的情况下，才会继续出现加载更多
                next(lis.join(''), page < "<{$count-1}>"); //假设总页数为 10
            }, 500);
        }
    });
});
</script>
</body>
</html>
